<?php
	require_once dirname(__FILE__) . '/../../utils/Utils.php';

  //引入公共参数
  $constant = include(dirname(__FILE__) . '/../../AppletConstant.php');
	
	/**
	 * 获取backendToken
	 *
	 */

	//调用地址
	$url = "https://open.95516.com/open/access/1.0/backendToken";

	//拼装参数Map
	$params 	=	array();
	$params["appId"] 			=	$constant["appId"];
  $params["secret"] 			=	$constant["SECRET"];

	$utils =	new Utils();

	//生成随即字符串

	$nonceStr = $utils->createNonceStr();

	$params["nonceStr"] 			=	$nonceStr;

	//生成时间戳
	$params["timestamp"] 			=	time();//1553053824;

	//签名
	$value =  $utils->sortMap($params);

	$signature = $utils->sha256($value);

    unset($params["secret"]);

	$params["signature"] 			=	$signature;


	//发送请求
	$resultStr 	=	$utils->sendPostGson($url,$params);
	header("Content-type: text/html; charset=utf-8");
	print_r("-------获取backendToken信息: ".$resultStr." --------- ");
    exit();
?>